import request from '@/utils/request'
import Qs from 'qs'
// 登录
export function login(data) {
  return request({
    headers: {
      'User-Type': '-1'
    },
    auth: {
      username: 'd0a492b7bcae45efb769a6f7ee1f3054',
      password: '188a9e58c0cc45b9a6c731e33180df10'
    },
    url: '/oauth/token',
    method: 'post',
    data: Qs.stringify(data)
  })
}

// 退出登录
export function logOut() {
  return request({
    url: '/sys/userAuth/logout',
    method: 'post'
  })
}

// 获取图形验证码
export function getCaptcha() {
  return request({
    url: '/sys/userAuth/captcha',
    method: 'get'
  })
}

// 验证图形验证码（不用）
export function verifyCaptcha(data) {
  return request({
    url: '/sys/userAuth/checkCaptcha',
    method: 'post',
    params: data
  })
}

// 校验客户端（不用）
export function verifyClient(data) {
  return request({
    url: '/oauth/token',
    method: 'get',
    params: data
  })
}

// 查询菜单
export function searchMenu() {
  return request({
    url: '/sys/menu/listMenu',
    method: 'get'
  })
}

// 发送验证码到邮箱
export const sendEmail = params => {
  return request({
    url: '/sys/userAuth/sendEmail',
    method: 'GET',
    params
  })
}
// 通过邮箱修改密码
export const updPasswordByEmail = data => {
  return request({
    url: '/sys/tenant/updPasswordByEmail',
    method: 'POST',
    data
  })
}
// 弹窗权限
export const isShowWindow = params => {
  return request({
    url: '/sys/tenant/isShowWindow',
    method: 'GET',
    params
  })
}
